package collect.taobao.util.groupPage;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import collect.taobao.util.SuperAction;
import collect.taobao.util.groupPage.ListGroup;
import collect.taobao.util.groupPage.PageBuffer;
//分页工具类Pagination.pageContent(1,"select * From useTable","xx/xxx.action"); 
//获得分页Pagination pg ,pg.getList()封装页面所要的list.
//返回request.setAttribute("pagination", pg.getNavigator1()); 封转的页面分页div标签
//lineNum 为一页显示几条记录
public class Pagination extends SuperAction {
	public List pageList = new ArrayList();

	public static PageBuffer pageContent(int currentPageNo,String sql,String url ,int lineNum){
		ListGroup pgGrop = new ListGroup();
		List list = pgGrop.getLimitString(currentPageNo, sql,lineNum);
		Map map  = pgGrop.getMaxPage(sql,lineNum);
	    int everyPageLine = Integer.parseInt(map.get("everyPageLine").toString());
	    int coutLine = Integer.parseInt(map.get("coutLine").toString());
		PageBuffer pg = new PageBuffer(currentPageNo, everyPageLine, url,coutLine);
		pg.setList(list);
		return pg;
	}

	public List getPageList() {
		return pageList;
	}

	public void setPageList(List pageList) {
		this.pageList = pageList;
	}

}
